# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Caleb Maclennan <caleb@alerque.com>
# Contributor: Stéphane Gaudreault <stephane@archlinux.org>
# Contributor: Thomas Dziedzic < gostrc at gmail >
# Contributor: Denis Martinez <deuns.martinez AT gmail.com>
# Contributor: Bogdan Burlacu <bogdan.burlacu AT pm.me>

pkgname=onetbb
pkgver=2021.10.0
pkgrel=1
pkgdesc='High level abstract threading library (oneAPI Threading Building Blocks)'
arch=('loong64' 'x86_64')
url='https://oneapi-src.github.io/oneTBB/'
license=('Apache')
depends=('gcc-libs' 'hwloc')
makedepends=('cmake' 'inetutils' 'ninja' 'python' 'swig')
conflicts=('intel-tbb' 'tbb')
provides=("intel-tbb=$pkgver" "tbb=$pkgver")
replaces=('intel-tbb' 'tbb')
source=(https://github.com/oneapi-src/oneTBB/archive/v$pkgver/$pkgname-$pkgver.tar.gz)
sha512sums=('d71cf317e7f78948c1ea20977cfcfba1eff72cb20c457c87e624cb3aaa3215a1c24eeeec11ed6ed99cf118c577d956234202458bb5e0215c9c317099d9c3b732')

build() {
  cd oneTBB-$pkgver
  cmake . -GNinja \
          -DCMAKE_INSTALL_PREFIX=/usr \
          -DTBB_STRICT=OFF \
          -DTBB4PY_BUILD=ON \
          -DCMAKE_BUILD_TYPE=None
  ninja all python_build
}

check() {
  cd oneTBB-$pkgver
  ninja test
}

package() {
  cd oneTBB-$pkgver
  DESTDIR="$pkgdir" ninja install
}
